package io.github.handyang.algorithms.search;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class TreeNode<K extends Comparable<K>, V> {
    private K key;
    private V value;

    private TreeNode<K, V> left;
    private TreeNode<K, V> right;

    public TreeNode(K key, V value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "key=" + key +
                ", value=" + value +
                ", left=" + (left == null ? "null" : left.getKey()) +
                ", right=" + (right == null ? "null" : right.getKey()) +
                '}';
    }
}
